﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

using ESRI.ArcGIS.ADF.BaseClasses;
using ESRI.ArcGIS.SystemUI;
using ESRI.ArcGIS.Controls;
using ESRI.ArcGIS.Carto;
using ESRI.ArcGIS.Geodatabase;


namespace SZ
{
    class TreeViewClass
    {
        //根据节点值查找treeView中的节点
        public TreeNode searchNode(string nodeValue, TreeView treeView)
        {
            TreeNode treeNode = null;
            try
            {
                if (treeView.Nodes.Count > 0)
                {
                    foreach (TreeNode ParentNode in treeView.Nodes)
                    {
                        if (ParentNode.Nodes.Count > 0)
                        {
                            foreach (TreeNode subNode in ParentNode.Nodes)
                            {
                                if (subNode.Text == nodeValue)
                                {
                                    treeNode = subNode;
                                    return treeNode;
                                }
                            }
                        }
                    }
                    return treeNode;
                }
                else
                    return treeNode ;
            }
            catch
            {
                return treeNode ;
 
            }
        }
    }
}
